package com.aceitunaproject.server.permissions;



import com.aceitunaproject.server.player.Player;
import com.aceitunaproject.shared.exceptions.gamerules.IllegalActionException;
import com.aceitunaproject.shared.exceptions.gamerules.PermissionDeniedException;

/**
 * @author Federico Bergstein
 * 
 *         Classes that implement this interface are used to determine if a
 *         player can execute a given action.
 */
public interface PermissionManager {

	/**
	 * 
	 * Determines if the player has permission to move an unit to a given map tile
	 * @param unitID the id of the unit
	 * @param destinationX the x coordinate of the destination tile
	 * @param destinationY the y coordinate of the destination tile
	 * @param player the player attempting to move the unit
	 *
	 * @throws IllegalActionException the permissions violated (if any)
	 */
	void canMoveUnit(long unitID, int destinationX, int destinationY,Player player) throws PermissionDeniedException;

	
	/**
	 * 
	 * Determines if the player has permission to build a settlement with an unit in a given map tile
	 * @param unitID the id of the unit
	 * @param destinationX the x coordinate of the settlement tile
	 * @param destinationY the y coordinate of the settlement tile
	 * @param player the player attempting to build the settlement
	 *
	 * @throws IllegalActionException the permissions violated (if any)
	 */	
	void canBuildSettlement(long unitID, int x, int y, Player player) throws PermissionDeniedException;

	/**
	 * 
	 * Determines if the player has permission to build an installation with an unit in a given map tile
	 * @param unitID the id of the unit
	 * @param installationType the installation type of the installation to build
	 * @param destinationX the x coordinate of the installation tile
	 * @param destinationY the y coordinate of the installation tile
	 * @param player the player attempting to build the installation
	 *
	 * @throws IllegalActionException the permissions violated (if any)
	 */
	void canBuildInstallation(long unitID,String installationType, int x, int y, Player player)throws PermissionDeniedException;


	void canRecruitUnit(long settlementId, int persons, Player player) throws PermissionDeniedException;;
}
